import com.spring.Service.UserServceImpi;
import com.spring.Service.UserService;
import com.spring.dao.MySqlImpi;
import com.spring.dao.OracloerImpi;
import org.apache.ibatis.javassist.ClassClassPath;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Mytext {
    public static void main(String[] args) {
        //获取AppLicationContex;
        ApplicationContext context = new ClassPathXmlApplicationContext("beans.xml");
        //容器在手，天下我有
        UserServceImpi userservce = (UserServceImpi) context.getBean("userservce");
        userservce.getUser();
    }
    @Test
    public void  test(){
//        这是以前的set注入方法：通过new
        UserServceImpi Service = new UserServceImpi();
//        Service.setUserDao(new MySqlImpi());
//        Service.getUser();
        //获取Oracle数据库
//        Service.setUserDao(new OracloerImpi());
//        Service.getUser();
        Service.getUser();
    }
}
